package org.example;

class Solution {
    public boolean isLongPressedName(String name, String typed) {
        int i = 0;
        int j = 0;
        while (i < name.length()) {
            char cur = name.charAt(i++);
            int curCount = 1;
            while (i < name.length() && name.charAt(i) == cur) {
                curCount++;
                i++;
            }
            int tCount = 0;
            while (j < typed.length() && typed.charAt(j) == cur) {
                tCount++;
                j++;
            }
            if (tCount < curCount) {
                return false;
            }
        }
        if (j != typed.length()) {
            return false;
        }
        return true;
    }
}

public class Main {
    public static void main(String[] args) {
        System.out.println("Hello world!");
    }
}